package AI;

import java.awt.Point;

import world.Map;

public class AI {
	
	private Point position;
	//lub:
	//private Player player;
	private Map map;
	
	public AI(Point position, Map map) {
		super();
		this.position = position;
		this.map = map;
	}

	
	
	void addStenchFormula() {
		
	}
	
	/**
	 * Adds new formulas to knowledge base.
	 * @param position
	 * @throws NoSuchFieldException
	 */
	void AddNewFormulas(Point position) throws NoSuchFieldException {
		
		if (map.getField(position.x, position.y) == LiteralType.WUMPUS.getNumber()) {
			System.out.println("AI: Why have you entered this field!?");
		} else if (map.getField(position.x, position.y) == LiteralType.STENCH.getNumber()) {
			// nie ma wiatru
			// TODO
		} else if (map.getField(position.x, position.y) == LiteralType.PIT.getNumber()) {
			System.out.println("AI: Why have you entered this field!?");
		} else if (map.getField(position.x, position.y) == LiteralType.BREEZE.getNumber()) {
			// nie ma smrodu
			// TODO
		} else if (map.getField(position.x, position.y) == LiteralType.AGENT.getNumber()) {
			System.out.println("AI: Are there two agents!?");
		} else if (map.getField(position.x, position.y) == LiteralType.EMPTY.getNumber()) {
			// TODO
		} else {
			throw new NoSuchFieldException(Integer.toString(map.getField(position.x, position.y)) );
		}	
	}
	
	
	void mainLoop() {
		try {
			AddNewFormulas(position);
			
			// find best move
			
			// do best move
			
		} catch (Exception e) {
			System.out.println(e);
			e.printStackTrace();
		}
	}
	

}
